<? include ("../init.php") ?>
<? include ("../header.php") ?>
<? include ("../menu.php") ?>
<? include ("submenu.php") ?>
<?php

  $news_id = $_GET['aid'];

  $sql = "SELECT * FROM news_promotion WHERE news_id = '".$news_id."'";
  $line = $db->queryUniqueObject($sql);
?>
<div id = "body">

<h1><?_l('edit')?> <?_l('news & promotion')?></h1>
<div class = "clear"></div>

<form method="post" action="update.php" class = "form" enctype="multipart/form-data">

  <input type = "hidden" name = "news_id" value = "<?=$news_id?>">
  <input type = "hidden" name = "old_img" value = "<?=$line->news_img?>">

  <div class = "field"><label><?_l('date')?></label><input type = "text" name = "date" class = "input size1" value = "<?=$line->news_date?>" id="datepicker"></div>
  <div class = "field"><label><?_l('image')?></label><input type = "file" name = "news_img" class = "input size1"></div>
  <?php if($line->news_img!='' AND file_exists("../../images/news-promotion/$line->news_img")){ ?>
  <div class = "field"><label>&nbsp;</label><img src="../../images/news-promotion/<?=$line->news_img?>" /></div>
  <?php } ?>
  <div class = "field"><label><?_l('detail')?></label><textarea name = "detail"><?=$line->news_detail?></textarea></div>
  <br/>
  <div class = "field"><label></label>
    <input type="submit" name="save" value = "<?_l('update')?>" class = "btn" />
    <input onclick = "javascript:history.back(1)" type = "button" value="<?_l('cancel')?>" class = "btn" />
  </div>
</form>

</div>


<style>
  .form label {
    width:80px;
  }
</style>
<script>
  $(document).ready(function(){
    $('#datepicker').datepicker({
      dateFormat: 'yy-mm-dd',
      changeMonth: true,
      changeYear: true
    });
  });
</script
<? include ("../footer.php") ?>